package org.yzh.web.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.yzh.web.entity.ElectronicFence;
import org.yzh.web.request.ElectronicFencePageSearchRequest;
import org.yzh.web.response.ElectronicFencePageSearchResponse;

import java.util.List;

/**
 * <p>
 * 电子围栏表 Mapper 接口
 * </p>
 *
 * @author zgp
 * @since 2023-10-31
 */
@Mapper
public interface ElectronicFenceMapper extends BaseMapper<ElectronicFence> {
    /**
     * 新增电子围栏数据
     *
     * @param electronicFence
     */
    @Insert("insert into electronic_fence (create_by,gmt_create,start_time,end_time,modified_by,gmt_modified,is_valid,ext_json,fence_name,fence_type,grade,color,serial_number) " +
            "values(#{createBy},#{gmtCreate},#{startTime},#{endTime},#{modifiedBy},#{gmtModified},#{isValid},#{extJson},#{fenceName},#{fenceType},#{grade},#{color},#{serialNumber})")
    void save(ElectronicFence electronicFence);


    void upDate(ElectronicFence electronicFence);

//    @Update("UPDATE electronic_fence SET " +
//            "is_valid = 0 " +
//            "WHERE id = #{id}")
    void remove(List<Integer> ids);


    List<ElectronicFencePageSearchResponse> select(ElectronicFencePageSearchRequest electronicFencePageSearchRequest);
}
